package com.nantian.nfcm.bms.loan.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nantian.nfcm.bms.loan.entity.LoanFiles;
import com.nantian.nfcm.bms.loan.service.LoanFilesService;
import com.nantian.nfcm.util.vo.ResultInfo;

@Controller
@RequestMapping("/loanFiles")
public class LoanFilesController {
    private static Logger log = LoggerFactory.getLogger(LoanFilesController.class);
    private LoanFilesService loanfilesService;
    
    public LoanFilesController(LoanFilesService loanfilesService) {
    	this.loanfilesService = loanfilesService;
	}
    
    /**
     * 根据ID查询贷款信息
     * @param loanBean
     * @return
     * @throws Exception
     */
    @RequestMapping("/findByType")
    @ResponseBody
    private ResultInfo findByBusinessType(String businessType, String businessSubType) throws Exception {
        ResultInfo resultInfo = new ResultInfo();
        try {
        	LoanFiles loanFiles = loanfilesService.findByBusinessType(businessType, businessSubType);
            resultInfo.setSuccess("true");
            //由于字段比较简单这里就不做单独的VO了直接用PO传递
            resultInfo.setData(loanFiles);
        } catch (Exception e) {
            log.error(e.getMessage());
            resultInfo.setSuccess("false");
            resultInfo.setData(e.getMessage());
        }
        return resultInfo;
    }
}
